#include <iostream>
#include <string>

using namespace std;

void test()
{
    //constructor
    string str1();
    string str2("Hello World");
    string str3("Hello World", 5);
    string str4(string("Hello World"));
    string str5(string("Hello World"), 3, 6);
    string str6(6, 'a');
    string str7(str2.begin(), str2.end());

    cout << str1 << endl;
    cout << str2 << endl;
    cout << str3 << endl;
    cout << str4 << endl;
    cout << str5 << endl;
    cout << str6 << endl;
    cout << str7 << endl;

    string str8 = str2 + str4;
    string str9 = str3 + "," + str5;
}

void test1()
{
    string str = "string";

    cout << str.empty() << endl;
    cout << str.size() << endl;
    cout << str.length() << endl;
    cout << str.append(" string") << endl;
    cout << str.find("string") << endl;
    cout << (str == str) << endl;
    cout << (str <= str) << endl;
}

void test2()
{
    string str = "string";

    for(int i = 0; i < str.size(); ++i)
    {
        cout << str[i] << " ";
    }
    cout << endl;

    for(auto & i : str)
    {
        cout << i << " ";
    }
    cout << endl;

    for(string::iterator it = str.begin(); it != str.end(); it++)
    {
        cout << *it << " ";
    }
    cout << endl;
}

int main()
{
    test1();
    test2();
    return 0;
}

